<!DOCTYPE html>
<html>
  <head>
    <meta name="creator" content="mantohtml v2.0.2">
    <title>mime.types(5)</title>
  </head>
  <body>
    <h1 id="mime.types-5">mime.types(5)</h1>
    <h2 id="mime.types-5.name">Name</h2>
<p>mime.types - mime type description file for cups
</p>
    <h2 id="mime.types-5.description">Description</h2>
<p>The <strong>mime.types</strong> file defines the recognized file types.
</p>
    <p>Additional file types are specified in files with the extension <em>.types</em> in the CUPS configuration directory.
</p>
    <p>Each line in the <strong>mime.types</strong> file is a comment, blank, or rule line.
Comment lines start with the # character.
Rule lines start with the MIME media type and are optionally followed by a series of file recognition rules:
</p>
    <pre>
    <em>mime/type </em>[ <em>rule </em>... <em>rule </em>]

</pre>
<p>Rules can be extended over multiple lines using the backslash character (\):
</p>
    <pre>
    <em>mime/type </em>[ <em>really-really-really-long-rule </em>... <strong>\
      </strong><em>rule </em>]

</pre>
<p>MIME media types specified by the <em>mime/type</em> field are case-insensitive and are sorted in ascending alphanumeric order for the purposes of matching.
See the &quot;TYPE MATCHING AND PRIORITY&quot; section for more information.
</p>
    <p>The rules may be grouped using parenthesis, joined using &quot;+&quot; for a logical AND, joined using &quot;,&quot; or whitespace for a logical OR, and negated using &quot;!&quot;.
</p>
    <h3 id="mime.types-5.description.rules">Rules</h3>
<p>Rules take two forms - a filename extension by itself and functions with test
values inside parenthesis.
The following functions are available:
</p>
    <p style="margin-left: 2.5em; text-indent: -2.5em;"><strong>match(&quot;</strong><em>PATTERN</em><strong>&quot;)</strong><br>
True if the filename matches the given shell wildcard <em>PATTERN</em>.
</p>
    <p style="margin-left: 2.5em; text-indent: -2.5em;"><strong>ascii(</strong><em>OFFSET</em><strong>,</strong><em>LENGTH</em><strong>)</strong><br>
True if the <em>LENGTH</em> bytes starting at <em>OFFSET</em> are valid printable ASCII (CR, NL, TAB, BS, 32-126).
<em>LENGTH</em> cannot exceed 8192 bytes.
</p>
    <p style="margin-left: 2.5em; text-indent: -2.5em;"><strong>printable(</strong><em>OFFSET</em><strong>,</strong><em>LENGTH</em><strong>)</strong><br>
True if the <em>LENGTH</em> bytes starting at <em>OFFSET</em> are printable 8-bit chars (CR, NL, TAB, BS, 32-126, 128-254).
<em>LENGTH</em> cannot exceed 8192 bytes.
</p>
    <p style="margin-left: 2.5em; text-indent: -2.5em;"><strong>priority(</strong><em>NUMBER</em><strong>)</strong><br>
Specifies the relative priority of this MIME media type.
The default priority is 100.
Larger values have higher priority while smaller values have lower priority.
</p>
    <p style="margin-left: 2.5em; text-indent: -2.5em;"><strong>string(</strong><em>OFFSET</em><strong>,&quot;</strong><em>STRING</em><strong>&quot;)</strong><br>
True if the bytes starting at <em>OFFSET</em> are identical to <em>STRING</em>.
</p>
    <p style="margin-left: 2.5em; text-indent: -2.5em;"><strong>istring(</strong><em>OFFSET</em><strong>,&quot;</strong><em>STRING</em><strong>&quot;)</strong><br>
True if the bytes starting at <em>OFFSET</em> match <em>STRING</em> without respect to case.
</p>
    <p style="margin-left: 2.5em; text-indent: -2.5em;"><strong>char(</strong><em>OFFSET</em><strong>,</strong><em>VALUE</em><strong>)</strong><br>
True if the byte at <em>OFFSET</em> is identical to <em>VALUE</em>.
</p>
    <p style="margin-left: 2.5em; text-indent: -2.5em;"><strong>short(</strong><em>OFFSET</em><strong>,</strong><em>VALUE</em><strong>)</strong><br>
True if the 16-bit big-endian integer at <em>OFFSET</em> is identical to <em>VALUE</em>.
</p>
    <p style="margin-left: 2.5em; text-indent: -2.5em;"><strong>int(</strong><em>OFFSET</em><strong>,</strong><em>VALUE</em><strong>)</strong><br>
True if the 32-bit big-endian integer at <em>OFFSET</em> is identical to <em>VALUE</em>.
</p>
    <p style="margin-left: 2.5em; text-indent: -2.5em;"><strong>locale(&quot;</strong><em>STRING</em><strong>&quot;)</strong><br>
True if current locale matches <em>STRING</em>.
</p>
    <p style="margin-left: 2.5em; text-indent: -2.5em;"><strong>contains(</strong><em>OFFSET</em><strong>,</strong><em>LENGTH</em><strong>,&quot;</strong><em>STRING</em><strong>&quot;)</strong><br>
True if the bytes starting at <em>OFFSET</em> for <em>LENGTH</em> bytes contains <em>STRING</em>.
<em>LENGTH</em> cannot exceed 8192 bytes.
</p>
    <h3 id="mime.types-5.description.string-constants">String Constants</h3>
<p>String constants can be specified inside quotes (&quot;&quot;) for strings containing whitespace and angle brackets (&lt;>) for hexadecimal strings.
</p>
    <h3 id="mime.types-5.description.type-matching-and-priority">Type Matching And Priority</h3>
<p>When CUPS needs to determine the MIME media type of a given file, it checks every MIME media type defined in the <em>.types</em> files.
When two or more types match a given file, the type chosen will depend on the type name and priority, with higher-priority types being used over lower-priority ones.
If the types have the same priority, the type names are sorted alphanumerically in ascending order and the first type is chosen.
</p>
    <p>For example, if two types &quot;text/bar&quot; and &quot;text/foo&quot; are defined as matching the
extension &quot;doc&quot;, normally the type &quot;text/bar&quot; will be chosen since its name is
alphanumerically smaller than &quot;text/foo&quot;.
However, if &quot;text/foo&quot; also defines a higher priority than &quot;text/bar&quot;, &quot;text/foo&quot; will be chosen instead.
</p>
    <h2 id="mime.types-5.files">Files</h2>
<p><em>/etc/cups</em> - Typical CUPS configuration directory.
</p>
    <h2 id="mime.types-5.examples">Examples</h2>
<p>Define two MIME media types for raster data, with one being a subset with higher priority:
</p>
    <pre>
    application/vnd.cups-raster  string(0,&quot;RaSt&quot;) string(0,&quot;tSaR&quot;) \
                                  string(0,&quot;RaS2&quot;) string(0,&quot;2SaR&quot;) \
                                  string(0,&quot;RaS3&quot;) string(0,&quot;3SaR&quot;)

    image/pwg-raster              string(0,&quot;RaS2&quot;) + \
                                  string(4,PwgRaster&lt;00>) priority(150)
</pre>
    <h2 id="mime.types-5.see-also">See Also</h2>
<a href="cups-files.conf.html"><p><strong>cups-files.conf</strong>(5),</a>

<a href="cupsd.conf.html"><strong>cupsd.conf</strong>(5),</a>

<a href="cupsd.html"><strong>cupsd</strong>(8),</a>

<a href="cupsfilter.html"><strong>cupsfilter</strong>(8),</a>

<a href="mime.convs.html"><strong>mime.convs</strong>(5),</a>

CUPS Online Help (<a href="http://localhost:631/help">http://localhost:631/help</a>)
</p>
    <h2 id="mime.types-5.copyright">Copyright</h2>
<p>Copyright &copy; 2020-2024 by OpenPrinting.
  </body>
</html>
